

#ifndef __1WIRE_H
#define __1WIRE_H

//#define ATMEGA_16
//#define LPC1766

#define CONVERT_T 0x44
#define READ_SCRATCHPAD 0xBE
#define WRITE_SCRATCHPAD 0x4E
#define COPY_SCRATCHPAD 0x48
#define READ_ROM 0x33
#define MATCH_ROM 0x55
#define SKIP_ROM 0xCC
#define SEARCH_ROM 0xF0
#define ALARM_SEARCH 0xEC

/////////////////////////ATMEGA code
//#ifdef ATMEGA_16

#define THERM_DDR DDRA
#define THERM_DQ 1
#define THERM_PORT PORTA
#define THERM_PIN PINA

#define PIN_DIR_INPUT() THERM_DDR&=~(1<<THERM_DQ)
#define PIN_DIR_OUTPUT() THERM_DDR|=(1<<THERM_DQ)
#define PIN_SET_LOW() THERM_PORT&=~(1<<THERM_DQ)
#define PIN_READ() THERM_PIN&(1<<THERM_DQ)
//#endif
/////////////////////////End of ATMEGA code
/*
/////////////////////////LPC code
#ifdef LPC1766

#define PIN_DIR_OUTPUT()  EXT_TEMP_FDIR |= EXT_TEMP_MASK
#define PIN_SET_LOW() EXT_TEMP_FCLR |= EXT_TEMP_MASK
#define PIN_DIR_INPUT() EXT_TEMP_FDIR &= ~EXT_TEMP_MASK
#define PIN_READ() EXT_TEMP_FIO&EXT_TEMP_MASK

#endif
*/
/////////////////////////End of LPC code


#define Int8U unsigned char

void ds_1wire_readtemp(void);

#endif